<html>
<head>
<meta charset="utf-8" />
<style type="text/css">
div#one {
	width: 100px;
	height: 2000px;
	background-color: blue;
	margin: 0px;
}

div#two {
	width: 100px;
	height: 1000px;
	background-color: red;
	margin: 0px;
}
</style>
</head>
<body>
	<button onclick="scrolltotop()">第二个div滚动到顶部对齐</button>
	<button onclick="scrolltobottom()">第二个div滚动到底部对齐</button>
	<button onclick="getfocus()">第二个div获取焦点</button>
	<button onclick="losefocus()">第二个div失去焦点</button>
	<button id="buttonfive">nothing</button>

	<div id="one"></div>
	<div id="two"></div>
</body>
<script type="text/javascript">
	function scrolltotop() {
		var divtwo = document.getElementById("two");
		divtwo.scrollIntoView(true);//滚动到第二个div的顶部和window可视区域的顶部对其
	}
	function scrolltobottom() {
		var divtwo = document.getElementById("two");
		divtwo.scrollIntoView(false);//滚动到第二个div的底部和window可视区域的底部对齐
	}
	function getfocus() {
		var divtwo = document.getElementById("two");
		divtwo.focus({
			preventScroll : false
		});
	}
	function losefocus() {
		var divtwo = document.getElementById("two");
		divtwo.blur();
	}
</script>

</html>